package com.telit.firecommand.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.telit.firecommand.entity.CommEmergencyPlan;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @Author:zhangwei
 * @Description:
 * @Time:Created on 2021/8/3 9:50
 */
public interface CommEmergencyPlanDao extends BaseMapper<CommEmergencyPlan> {

    /**
     * 分页条件查询应急预案信息
     *
     * @param emergencyPlanIPage
     * @param startTime
     * @param endTime
     * @param planName
     *
     * @return
     */
    IPage<CommEmergencyPlan> selectPageByCondition(
            @Param("emergencyPlanIPage") IPage<CommEmergencyPlan> emergencyPlanIPage,
            @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("planName") String planName,
            @Param("planType") String planType, @Param("fileCode") String fileCode);

    /**
     * 无分页条件查询应急预案信息
     *
     * @param startTime
     * @param endTime
     * @param planName
     *
     * @return
     */
    List<CommEmergencyPlan> selectByConditionNoPage(@Param("startTime") String startTime,
                                                    @Param("endTime") String endTime,
                                                    @Param("planName") String planName,
                                                    @Param("planType") String planType,
                                                    @Param("fileCode") String fileCode);

@Select("select count(id) from comm_emergency_plan where plan_type=#{planType}")
   Integer  selectUsePlanType(@Param("planType")String planType );

}
